package com.hsxc.cdz.monitor.bean.second;

public class Errcode {
	private byte bit0;  //电流故障
	private byte bit1;  //电压故障
	private byte bit2;  //其他
	
	
	public static final String ERR_CURRENT = "08"; //电流故障
	public static final String ERR_VOLTAGE = "09"; //电压故障
	/*****************************************************/
	//构造方法
	public Errcode(){
		
	}
	public Errcode(byte data){
		bit0 = (byte)(data&0x1);
		bit1 = (byte)(data>>1&0x1);
		bit2 = (byte)(data>>2&0x1);
	}

	/******************************************************/
	public String getErrcode(){
		if(bit0==1){
			return ERR_CURRENT;
		}else if(bit1==1){
			return ERR_VOLTAGE;
		}else if(bit2==1){
			return Fault.ERR_OTHER;
		}
		return Fault.NOMAL;
	}

	/***************************************************/
	//get() and set()
	public byte getBit0() {
		return bit0;
	}

	public void setBit0(byte bit0) {
		this.bit0 = bit0;
	}

	public byte getBit1() {
		return bit1;
	}

	public void setBit1(byte bit1) {
		this.bit1 = bit1;
	}

	public byte getBit2() {
		return bit2;
	}

	public void setBit2(byte bit2) {
		this.bit2 = bit2;
	}
}
